package demo1;

public class Test {

    public static void main(String[] args) {
        MyValue myValue = new MyValue();
        MyValue myValue1 = new MyValue();
        myValue.val = 10;
        myValue1.val = 20;
        System.out.println("交换前:myValue.val = " + myValue.val + ", myValue2.val = " + myValue1.val);
        swap(myValue, myValue1);
        System.out.println("交换后:myValue.val = " + myValue.val + ", myValue2.val = " + myValue1.val);
    }

    public static void swap(MyValue myValue1, MyValue myValue2){
        int tmp = myValue1.val;
        myValue1.val = myValue2.val;
        myValue2.val = tmp;
    }

    public static void main1(String[] args) {
        Dog dog = new Dog("小狗", 3, "白色");
        Dog dog1 = new Dog();

        System.out.println("===================");
        Cat cat = new Cat();
        Cat cat1 = new Cat();

    }
}
